package flc.ast;

import android.app.Application;

import com.blankj.utilcode.util.SPUtils;
import com.stark.cartoonavatarmaker.lib.core.AvatarRoleDbUtil;
import com.stark.cartoonavatarmaker.lib.core.AvatarTemplate;
import com.stark.cartoonavatarmaker.lib.core.AvatarTemplateProvider;
import com.stark.cartoonavatarmaker.lib.core.AvatarUtil;

import java.util.List;

import flc.ast.utils.Content;
import stark.common.basic.view.container.StkEventContainer;

/**
 * create by fanlc
 * on 1/7/21
 * description
 */
public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        StkEventContainer.showInDebug = false;
        boolean isInit = SPUtils.getInstance().getBoolean(Content.isInitRole, false);
        if (!isInit) {
            List<AvatarTemplate> list = AvatarTemplateProvider.getCategories().get(2).templates;
            for (AvatarTemplate avatarTemplate : list) {
                AvatarRoleDbUtil.insert(AvatarUtil.createAvatarRoleFromAvatarTemplate(avatarTemplate));
            }
            SPUtils.getInstance().put(Content.isInitRole, true);
        }
    }
}
